package com.yonyou.iuap.shell.dao;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.yonyou.iuap.base.dao.IKmBaseDao;
import com.yonyou.iuap.base.dao.MyBatisDao;
import com.yonyou.iuap.persistence.mybatis.anotation.MyBatisRepository;
import com.yonyou.iuap.shell.entity.KmPublishEntity;
import com.yonyou.iuap.shell.entity.exp.KmAttPoJo;
import com.yonyou.iuap.shell.entity.exp.KmpublishPoJo;
import com.yonyou.iuap.shell.entity.exp.KmpublishfaPoJo;
import com.yonyou.iuap.shell.entity.exp.KmpublishfacomPoJo;
import com.yonyou.iuap.shell.pub.IShellDaoEnum;
import com.yonyou.iuap.shell.pub.RequestDto;


/**
 * 
 * KmPublishEntityDao数据库操作接口类
 * 
 **/
@MyBatisRepository
@Repository(value=IShellDaoEnum.Shell_Dao_KmPublishEntityDao)
public interface KmPublishEntityDao<T> extends IKmBaseDao<T>{
	/**
	 * 根据条件查询知识发布和附件信息
	 * @param whereSql
	 * @return
	 */
	public List<KmAttPoJo> queryKnowledgeAttachment(Map<String, String> map);
	
	/**根据知识pk查询知识信息
	 * @param map
	 * @return
	 */
	public List<KmAttPoJo> queryKnowledgebypk(Map<String, String> map);
	
	/**根据知识pk查询知识附件
	 * @param map
	 * @return
	 */
	public List<KmAttPoJo> queryKnowledgeattbypk(Map<String, String> map);
	
	/**
	 * 根据关键字查询知识发布和评论，收藏信息
	 * @param whereSql
	 * @return
	 */
	public List<KmpublishPoJo> queryKmpublishPoJoLike(RequestDto req);
	/**
	 * 知识数量统计
	 * **/
	public List<KmpublishPoJo> CountKmpublishPoJo();
	
	public List<KmpublishfaPoJo> queryKmpublishfavoarite();
	
	public List<KmpublishfacomPoJo> queryKmpublishfavoaritecomment();
	
	/**
	 * 条件查询知识库列表 （分页 ） -------------- 
	 * @param red
	 * @return
	 */
	public List<KmpublishPoJo> queryKmpublishPoJoLikePc(RequestDto red);
	
	/**
	 * 条件查询知识库列表 总计
	 * @param red
	 * @return
	 */
	public int queryKmpublishPoJoLikePcCount(RequestDto red);
	
	/**
	 * 修改不为空的字段
	 * @param kp
	 */
	public int updateKmPublishEntityTj(KmPublishEntity kp);
	
	/**
	 * 知识修改前 拉取当前要修改的知识信息
	 * @param pk_km_publish   知识id
	 * @return
	 */
	public KmpublishPoJo updatePublishFront(String pk_km_publish);
	
	/**
	 * 删除知识下的所有评论
	 * @param pk_km_publish
	 * @return
	 */
	public int deleteByPrimaryKeyComment(String pk_km_publish);
	/**
	 * 统计知识数量
	 * @param req
	 * @return
	 */
	public int countKmpublishPoJoLike(RequestDto req);
	
	public List<KmPublishEntity> selectPublishPage(RequestDto req);
	
	/**
	 * 关键字修改
	 * @param map
	 * @return
	 */
	public void updateKey(Map<String,String> map);
}
